package com.special.threademo.netty.second;

import com.special.threademo.netty.basic.TestServerInitializer;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;

/**
 * Created with IDEA2020.3
 * author:LiuYC
 * DateTime:2021/1/27  9:37
 */
public class MyClient {
    public static void main(String[] args) throws Exception {
        NioEventLoopGroup clientGroup = new NioEventLoopGroup();
        try {

            Bootstrap bootstrap = new Bootstrap();
            bootstrap.group(clientGroup).channel(NioServerSocketChannel.class).handler(null);
            ChannelFuture localhost = bootstrap.connect("localhost", 8899).sync();
            //ChannelFuture sync = serverBootstrap.bind(8899).sync();
            localhost.channel().closeFuture().sync();
        } finally {
            clientGroup.shutdownGracefully();
            //workerGroup.shutdownGracefully();
        }


    }
}
